Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tether

Package Overview
Dependencies
Maintainers
9
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tether

A client-side library to make absolutely positioned elements attach to elements in the page efficiently.

  • 1.4.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
246K
decreased by-5.49%
Maintainers
9
Weekly downloads
 
Created

What is tether?

The 'tether' npm package is a JavaScript library for efficiently positioning elements on a web page. It allows you to attach elements to other elements, ensuring that they stay in the correct position even when the page is scrolled or resized.

What are tether's main functionalities?

Basic Tethering

This feature allows you to attach an element (e.g., a tooltip) to another element (e.g., a button). The 'attachment' and 'targetAttachment' properties define how the elements are positioned relative to each other.

const Tether = require('tether');

const tether = new Tether({
  element: document.querySelector('#tooltip'),
  target: document.querySelector('#button'),
  attachment: 'top left',
  targetAttachment: 'bottom left'
});

Constraints

This feature allows you to add constraints to the tethered element, ensuring it stays within the bounds of a specified container (e.g., the window). The 'constraints' property takes an array of constraint objects.

const Tether = require('tether');

const tether = new Tether({
  element: document.querySelector('#tooltip'),
  target: document.querySelector('#button'),
  attachment: 'top left',
  targetAttachment: 'bottom left',
  constraints: [{
    to: 'window',
    attachment: 'together'
  }]
});

Offset

This feature allows you to specify an offset for the tethered element. The 'offset' property takes a string with the horizontal and vertical offsets.

const Tether = require('tether');

const tether = new Tether({
  element: document.querySelector('#tooltip'),
  target: document.querySelector('#button'),
  attachment: 'top left',
  targetAttachment: 'bottom left',
  offset: '10px 20px'
});

Other packages similar to tether

FAQs

Package last updated on 16 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc